Ubuntu 10.04
Sponsored Link

Mail Log Analyzer - AWstats
2010/07/31
  Install maillog analyzer, AWstats. Web Server is also required to installed.

[1] Install AWstats
root@mail05:~#
aptitude -y install awstats


root@mail05:~#
cp /etc/awstats/awstats.conf /etc/awstats/awstats.postfix.conf

root@mail05:~#
cp /usr/share/doc/awstats/examples/maillogconvert.pl /usr/share/awstats

root@mail05:~#
vi /etc/awstats/awstats.postfix.conf


# line 51: change

LogFile="
/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |
"

# line 63: change

LogType=
M


# line 122 make it comment and add the line below

#
LogFormat=1
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"


# line 153 specify hostname

SiteDomain="
mail05.srv.world"
"

# line 222: change

DirIcons="
./icon
"

# line 831: change like below

LevelForBrowsersDetection=
0

LevelForOSDetection=
0

LevelForRefererAnalyze=
0

LevelForRobotsDetection=
0

LevelForSearchEnginesDetection=
0

LevelForKeywordsDetection=
0

LevelForFileTypesDetection=
0

LevelForWormsDetection=0

# line 905: change your language

Lang="
jp
"

# line 949: change like below

ShowMonthStats=
UHB

ShowDaysOfMonthStats=
HB

ShowDaysOfWeekStats=
HB

ShowHoursStats=
HB

ShowDomainsStats=
0

ShowHostsStats=
HBL

ShowRobotsStats=
0

ShowEMailSenders=
HBML

ShowEMailReceivers=
HBML

ShowSessionsStats=
0

ShowPagesStats=
0

ShowFileTypesStats=
0

ShowOSStats=
0

ShowBrowsersStats=
0

ShowOriginStats=
0

ShowKeyphrasesStats=
0

ShowKeywordsStats=
0

ShowMiscStats=
0

ShowHTTPErrorsStats=
0

ShowSMTPErrorsStats=
1


root@mail05:~#
mkdir /var/www/awstats

root@mail05:~#
ln -s /usr/share/awstats/icon /var/www/awstats/icon

root@mail05:~#
vi /etc/apache2/sites-available/default


<Directory "/usr/lib/cgi-bin">

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from
10.0.0.0/24
# IP address you allow

</Directory>


# add lines

<Location /awstats>

Order deny,allow

Deny from all

Allow from 10.0.0.0/24
# IP address you allow

</Location>

</VirtualHost>

root@mail05:~#
/etc/init.d/apache2 restart

  * Restarting web server apache2
  ... waiting ...done.

# generate reports

root@mail05:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -update

Create/Update database for config "/etc/awstats/awstats.postfix.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 73
Found 0 dropped records,
Found 0 corrupted records,
Found 73 old records,
Found 0 new qualified records.

# generate HTML from reports above

root@mail05:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -output -staticlink > /var/www/awstats/index.html

[2] Access to 'http://(your server's name or IP address)/awstats/' with web browser. Then following screen is shown and it's possible to make sure mail log summary.
 
 
Tweet